package com.lzj.demo.design.iterator;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class Test {
    public static void main(String[] args) {
        GroupStructure groupStructure = new GroupStructure(1L,"Faker's girls");
        //雇员信息
        groupStructure.add(new Employee(2L,"GYY","二级部门"));
        groupStructure.add(new Employee(3L,"LWX","二级部门"));
        groupStructure.add(new Employee(4L,"SAR","三级部门"));
        groupStructure.add(new Employee(5L,"JXH","三级部门"));
        groupStructure.add(new Employee(6L,"ZQH","四级部门"));
        groupStructure.add(new Employee(7L,"ZJ","四级部门"));
        groupStructure.add(new Employee(8L,"ZXM","四级部门"));
        //节点关系
        groupStructure.addLink(1L,new Link(1L,2L));
        groupStructure.addLink(1L,new Link(1L,3L));
        groupStructure.addLink(2L,new Link(2L,4L));
        groupStructure.addLink(2L,new Link(2L,5L));
        groupStructure.addLink(5L,new Link(5L,6L));
        groupStructure.addLink(5L,new Link(5L,7L));
        groupStructure.addLink(5L,new Link(5L,8L));

        Iterator<Employee> iterator = groupStructure.iterator();
        while (iterator.hasNext()){
            Employee employee = iterator.next();
            log.info("{},雇员 Id:{} Name:{}",employee.getDesc(),employee.getUId(),employee.getName());
        }
    }
}
